import request from "@/request";

//查询所有父级权限列表接口
export const getAllParentAuthList = ()=> {
    return request.get('/authManager/getParentAuthList')
}

//查询父级权限的子级权限列表接口
export const getChildAuthList = (pidName)=> {
    let params = new URLSearchParams()
    params.append('pidName',pidName)
    return request.get('/authManager/getChildAuthList', {params})
}

//修改权限信息接口
export const editAuth = (authId,name,uri)=>{
    let params = new URLSearchParams()
    params.append('authId',authId)
    params.append('name',name)
    params.append('uri',uri)
    return request.post('/authManager/editAuthInfo',params)
}

//禁用权限接口
export const forbiddenAuth = (authId)=> {
    let params = new URLSearchParams()
    params.append('authId',authId)
    return request.get('/authManager/forbiddenAuth', {params})
}

//解禁权限接口
export const unForbiddenAuth = (authId)=> {
    let params = new URLSearchParams()
    params.append('authId',authId)
    return request.get('/authManager/unForbiddenAuth', {params})
}

//添加一级权限接口
export const addParentAuth = (name,uri)=> {
    let params = new URLSearchParams()
    params.append('name',name)
    params.append('uri',uri)
    return request.put('/authManager/addParentAuth',params)
}

//删除父级权限接口
export const deleteParentAuth = (pidName)=> {
    let params = new URLSearchParams()
    params.append('pidName',pidName)
    return request.delete('/authManager/removeParentAuth', {params})
}

//添加子权限接口
export const addChildAuth = (pidName,name,uri)=> {
    let params = new URLSearchParams()
    params.append('pidName',pidName)
    params.append('name',name)
    params.append('uri',uri)
    return request.put('/authManager/addChildAuthInParentAuth',params)
}

//删除子权限接口
export const removeChildAuth = (authName)=>{
    let params = new URLSearchParams()
    params.append('authName',authName)
    return request.delete('/authManager/removeAnChildAuth', {params})
}